<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <!-- import CSS -->
  <link rel="stylesheet" href="../js/3rd/elementUi/index.css">
  <link rel="stylesheet" href="../css/pc.css">
  <script src="../js/3rd/elementUi/vue.js"></script>
  <script src="../js/3rd/jquery-3.1.1.min.js"></script>
</head>
<body>
  <div id="creatProject" class="admin" style="display:none">
    
	<el-container>
	  <el-aside class="sider-bar" id="siderbar">
      <div class="logo"><img src="../image/logo.jpg">来赚吧管理后台</div> 
	    <tp-siderbar title="发布项目"></tp-siderbar>
	  </el-aside>
	  <div class="right-content">
      <el-breadcrumb separator-class="el-icon-arrow-right" class="bread-bd">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>活动管理</el-breadcrumb-item>
      </el-breadcrumb>
      <div class="l-bd"> 
        <el-button type="primary" size="small" @click="submitProject">确认发布</el-button>
      </div>
      <div class="left-b">  		  
  		  <div class="input-group">
  	        <div class="title">*通知名称：</div>
  	        <div class="input">
  	        	<el-input  placeholder="请输入内容" v-model="noticeData.title"></el-input>
  	        </div>			
  			<div class="clearfix"></div>
  		  </div>
  	     
          <div class="input-group">
            <div class="title">通知介绍：</div>
            <div class="input" >
              <el-input 
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 10}"
                placeholder="通知详情"
                v-model="noticeData.content">
              </el-input>
            </div>      
            <div class="clearfix"></div>
          </div>
        </div>  
      </div>
      <div class="clearfix"></div>
	</el-container>



  </div>
</body>


  <!-- import JavaScript -->
  <script src="../js/3rd/elementUi/index.js"></script>
  <script src="../js/js/admin_siderbar.js"></script>
  <script src="../js/js/common.js"></script>
  <script>
   var token=getCookie("userToken");
   var userId=getCookie("userId");
   console.log(token)
   console.log(userId)
   if(!token||!userId){
      window.location.href = "/admin/login.html";
   }
   var noticeData={
               client:3,
               content:'',
               title:'',
               token:'',
               userId:''
               }
    new Vue({
      el: '#creatProject',
      data: {
      
        noticeData:noticeData,
        isDoingSubmitNotice:false
      },
      created:function(){
          this.noticeData.token=token;
          this.noticeData.userId=parseInt(userId);
          $("#creatProject").show();
      },
      methods:{
        
        submitProject:function(){
          if(this.isDoingSubmitNotice){
            return;
          }

          if(!this.noticeData.title){
              this.$alert('通知名称必填', '缺少信息', {
                confirmButtonText: '确定',
              });
            return;
          }      
          this.isDoingSubmitNotice=true;
          var url="/noice/saveNotice  ";
          console.log(this.noticeData);
          var data=this.noticeData;
          pushData(url,data,function(res){
                this.isDoingSubmitNotice=false;
                console.log(res);
                if(res.state){
                  alert("发布成功")
                  window.location.href="/admin/noticeList.html";
                }else if(res.errorCode==008){
                	window.location.href = "/admin/login.html";
                }
                else{
                  alert(res.message)
                }
          }.bind(this))
        }

      }
      
    })
  </script>
</html>